def f(arr,n):
  s = []
  arr_i = 0

  for i in range(1,n+1):
    s.append(i)
    while s and arr[arr_i] == s[-1]:
      s.pop()
      arr_i+=1
  while s:
    if s[-1] != arr[arr_i]:
      print("No")
      return
    s.pop()
    arr_i+=1
  print("Yes")

n = int(input())
while n:
  arr = list(map(int,input().split()))
  f(arr,n);
  n = int(input())
